//
//  CHWXQYDetailCell.m
//  CarFile
//
//  Created by 陈浩 on 2017/6/2.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CHWXQYDetailCell.h"
@interface CHWXQYDetailCell()

@property (nonatomic ,strong) UILabel *titleLabel;
@property (nonatomic ,strong) UILabel *detailLabel;
@property (nonatomic ,strong) UIImageView *arrowImgView;
@property (nonatomic ,strong) UIView *line;
@end
@implementation CHWXQYDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


+(instancetype)cellForTableView:(UITableView *)tableView{
    static NSString *ID = @"CHWXQYDetailCell";
    CHWXQYDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[CHWXQYDetailCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return cell;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
       
        [self setupUI];
    }
    return self;
}

-(void)setupUI{
    
    UILabel *titleLabel = [[UILabel alloc] init];
    titleLabel.font = Font(13);
    titleLabel.textAlignment = NSTextAlignmentLeft;
    titleLabel.textColor =  [UIColor colorWithHexString:@"888888" alpha:1.0f];
    [self.contentView addSubview:titleLabel];
    self.titleLabel = titleLabel;

    UIImageView *arrowImgView= [[UIImageView alloc] init];
    arrowImgView.image = [UIImage imageNamed:@"right_arrow"];
    [self.contentView addSubview:arrowImgView];
    self.arrowImgView = arrowImgView;
    
    UILabel *detailLabel = [[UILabel alloc] init];
    detailLabel.textAlignment = NSTextAlignmentRight;
    detailLabel.font = Font(13);
    detailLabel.textColor =  [UIColor colorWithHexString:@"888888" alpha:1.0f];
    [self.contentView addSubview:detailLabel];
    self.detailLabel = detailLabel;
    
    UIView *line = [[UIView alloc] init];
    line.backgroundColor = [UIColor colorWithHexString:@"eeeef0" alpha:1];
    [self.contentView addSubview:line];
    self.line = line;
    


}

-(void)setModel:(QYDetailModel *)model{
    _model = model;
    self.titleLabel.text = model.title;
    self.detailLabel.text = model.result;
    
}

-(void)setIsJump:(BOOL)isJump{
    _isJump = isJump;
    self.arrowImgView.hidden = !isJump;
}


-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.titleLabel.frame = CGRectMake(10, 0, UIScreenW/2, self.h);
    self.arrowImgView.frame = CGRectMake(UIScreenW - 15 -10, (self.h - 15) /2, 10, 15);
    self.detailLabel.frame = CGRectMake(UIScreenW -self.arrowImgView.w -100 - 20, 0,100, self.h);
    self.line.frame = CGRectMake(0, self.frame.size.height-1, self.frame.size.width, 1);
    
    
}


@end
